unit NtFuncs;

interface
Uses SysUtils;
//MASKS of Acess MASK
const
  //PROCESS_CONSTS
  PROCESS_CREATE_PROCESS = $0080;
  PROCESS_CREATE_THREAD = $0002;
  PROCESS_DUP_HANDLE = $0040;
  PROCESS_QUERY_INFORMATION =$0400;
  PROCESS_QUERY_LIMITED_INFORMATION = $1000;
  PROCESS_SET_INFORMATION = $0200;
  PROCESS_SET_QUOTA = $0100;
  PROCESS_SUSPEND_RESUME = $0800;
  PROCESS_VM_OPERATION = $0008;
  PROCESS_VM_WRITE = $0020;
  PROCESS_TERMINATE = $0001;
  PR_Synchronize = $00100000;
  _EACCES_DENIED =$C0000022;
type
  NTSTATUS = Cardinal;
  PUNICODE_STRING = ^UNICODE_STRING;
  UNICODE_STRING =
  packed record
    Length: Word;
    MaximumLength: Word;
    Buffer: PwideChar;
  end;

  PHANDLE = ^THANDLE;


  POBJECT_ATTRIBUTES = ^OBJECT_ATTRIBUTES;
  OBJECT_ATTRIBUTES =
  packed record
    Length: Cardinal;
    RootDirectory: Thandle;
    ObjectName: PUNICODE_STRING;
    Attributes: Cardinal;
    SecurityPointer: Pointer;
    SecurityQualityOfService: Pointer;
  end;
  PDWORD = ^Cardinal;
  PClientID = ^ClientID;
  ClientID = packed
  record
    UniqueProcess: Cardinal;
    UniqueThread: Cardinal;
  end;

{-----------------USERMODE FUNCTIONS--------------}
function NtTerminateProcess(ProcessHandle: Cardinal;
  ExitStatus: Cardinal): NTSTATUS; stdcall; external 'ntdll.dll';

function NtOpenProcess(var ProcessHandle: PHANDLE; DesiredAccess: Cardinal;
 ObjectAttributes: POBJECT_ATTRIBUTES; Cl_Id: Pointer): NTSTATUS; stdcall; external 'ntdll.dll';
{----------------KERNELMODE FUNCTIONS-------------}
function ZwOpenProcess(var ProcessHandle: PHANDLE; DesiredAccess: Cardinal;
 ObjectAttributes: POBJECT_ATTRIBUTES; ClientID: Pointer): NTSTATUS; stdcall; external 'ntdll.dll';

function ZwTerminateProcess(ProcessHandle: Cardinal;
  ExitStatus: Cardinal): NTSTATUS; stdcall; external 'ntdll.dll';

function NtQuerySystemInformation(SystemInformationClass: Cardinal;
 SystemInformation: pointer; SystemInformationLength: Cardinal;
  ReturnLength: PDWORD):cardinal; stdcall; external 'ntdll.dll';
implementation

end.
